class Solution {
    int posSum(int num)
    {
        int sum = 0;
        while(num)
        {
            sum += (num % 10);
            num /= 10;
        }
        return sum;
    }
public:
    int minElement(vector<int>& nums) {
        int minValue = INT_MAX;
        for(int &x : nums)
            minValue = min(minValue, posSum(x));
        return minValue;
    }
};